 <!-- DANG NHAP -->
  <div class="container">
  <div class="row">
     <div style="margin-top:40px"></div>
     <div class="col-md-12" style="border-right:1px dashed #CCC">
     		<h3 class="font"><i class="icon-facebook"></i> ĐĂNG NHẬP BẰNG TÀI KHOẢN FACEBOOK </h3>
           
  <Br/>
    
      <script>
var _jsDep = { FBLogin: function () { 
function t(t) { 

if (e) return; e = true;
		 $("#signedRequest").val(t.authResponse.signedRequest);
		 $("#accessToken").val(t.authResponse.accessToken);
		
		FB.api("/me", function (e) { 
				 if (e.name) { 
				 $("#membername").val(e.name); 
				 $("#memberemail").val(e.email);
				 $("#fbuid").val(e.id);
				  $("#birthday").val(e.birthday);
				 $("#sex").val(e.gender);
				  $("#username").val(e.username); 
				   $("#username").val(e.id); 
		
		//Send ajax request
	
	// Query get user info with fromid
	//Send data to server using ajax ------ KAKAKAKAKAKA
			 var   values='token='+t.authResponse.accessToken+'&username='+e.username+'&email='+e.email+'&facebook_id='+e.id+'&name='+e.name+'&facebook=1&module=user&act=login_facebook';
	$(".login_wait").css("display", "block");
	$(".login_nt").css("display", "none") 
  	$.ajax({
      url: "index.php",
      type: "post",
      data: values,
      success: function(data){
		
		data=$.trim(data);
		if(data=='success'){
      		popupMessage('Thành công', <?= json_encode(array('Đăng nhập thành công.')); ?>, 'alert-success');
			$('#popup_message').prepend('<div class="loading" id="mainLoading"><div id="loadMoreItems" class="normalLoadBtn"><img width="20" src="public/images/loading.gif" alt="loading" /> Loading </div><div class="clr"></div></div>');
			$('#mainLoading').delay(1500).slideUp(function(){
				window.location.href = '<?= HOME ?>';
    		});
			//location.href='<?php echo HOME ?>';
		}else
		if(data=='success_add'){
			location.href='<?php echo USER_CHANGEPASSWORD ?>';
		}
		else{
			popupMessage('Thành công', <?= json_encode(array('Có lỗi xảy ra, vui lòng thử lại.')); ?>, 'alert-danger');
			$('#popup_message').prepend('<div class="loading" id="mainLoading"><div id="loadMoreItems" class="normalLoadBtn"><img width="20" src="public/images/loading.gif" alt="loading" /> Loading </div><div class="clr"></div></div>');
			$('#mainLoading').delay(1500).slideUp(function(){
			//	window.location.href = '<?= LOGIN ?>';
    		});
		}
      },
     
    }); 
		//End of send ajax request
		
			
				}
		}) 
}  //end of t function


window.fbAsyncInit = function () { 

		FB.init({ appId: "<?php echo FB_ID;?>", status: true, cookie: true, xfbml: true });

		FB.getLoginStatus(function (e) {
				 if (!e.authResponse) { $(".login_wait").hide(); 
				 $(".login_nt").show() } else { t(e) } 
			 });
 
		 FB.Event.subscribe("auth.statusChange", function (e) { 
		 if (e.authResponse) { 
					t(e); $(".login_wait").css("display", "none"); 
					$(".login_nt").css("display", "block") 
			} else { 
				$(".login_wait").css("display", "block");
				$(".login_nt").css("display", "none") 
				} 
			})
			
			
 }; 
 
 
 var e = false }, 
 
 InitFB: function () { 
 (function (e, t, n) { 
 var r, i = e.getElementsByTagName(t)[0];
 if (e.getElementById(n)) return; 
 r = e.createElement(t); 
 r.id = n; r.src = "//connect.facebook.net/vi_VN/all.js#xfbml=1&appId=<?php echo FB_ID;?>";
 i.parentNode.insertBefore(r, i) })(document, "script", "facebook-jssdk") } };
 
 
$(function () { _jsDep.InitFB();  })

</script>






 <div class="login_content">
                <div class="login_wait"><span><button type="button" data-loading-text="" class="btn btn-primary">Đang kết nối với tài khoản facebook, xin vui lòng đợi...</button></span></div>
                <div class="login_nt">Click vào nút bên dưới để đăng nhập bằng tài khoản Facebook của bạn.
                    <div id="fb-root"></div>
                    <div class="fb-login-button" data-show-faces="false" data-width="200" data-max-rows="1" data-scope="email,user_birthday,publish_actions"></div>
                </div>
            </div>
        
            
            <script type="text/javascript">
            _jsDep.FBLogin();
        </script>
     </div>
   


  </div>
  </div>
  <!-- DANG NHAP END -->
  <div style="height:100px"></div>